// 后台路由

const express = require('express');
const router = express.Router();



//引入后台控制器
const adminController = require('../controllers/adminController');

router.get('/',adminController.index);

router.get('/login',adminController.loginPage);

router.post('/login',adminController.login);

//------------------------用户管理------------------
//显示用户所有数据
router.get('/user',adminController.listUser)

//新增:第一步
router.get('/add',adminController.addPage)
//新增：第二步
router.post('/add',adminController.addUser)

//编辑第一步
router.get('/edit/:id',adminController.getOneUser)

//编辑第二步
router.post('/edit',adminController.editUser)

//删除
router.get('/delete/:id',adminController.deleteUser)

//查询
router.post('/search',adminController.searchUser)


// ---------------菜单管理-------------------

router.get('/menu',adminController.menu);
router.get('/menuAdd',adminController.menuAdd);
router.post('/menuAdd',adminController.menuAddUser);
router.get('/menuEdit/:id',adminController.menuEdit);
router.post('/menuEdit',adminController.menuEditUser);
router.get('/menuDelete/:id',adminController.menuDelete );

// -------------文章分类模块-------------------
router.get('/classify',adminController.classify);
router.get('/classAdd',adminController.classifyAdd);
router.post('/classAdd',adminController.classifyAddUser);
router.get('/classEdit/:id',adminController.classifyEdit);
router.post('/classEdit',adminController.classifyEditUser);
router.get('/classDelete/:id',adminController.classifyDelete );

// -----------------------------文章管理------------------
// 显示所有文章
router.get('/artical',adminController.getAllArtical);

// 新增跳转页面
router.get('/addArtical',adminController.addArticalPage);

router.post('/addArtical',adminController.addArtical);

// 删除页面
router.get('/deleteArtical/:id',adminController.deleteArtical);

// 修改页面
router.get('/editArtical/:id',adminController.editArticalPage);

router.post('/editArtical',adminController.editArtical);




module.exports = router;